* JEPOP paper: REVISED to parallel draft 

set more off
log using jepop.log, replace 
use "ines11plusballots copy.dta", clear
drop if QB4CB > 10
recode QB4CB 6 7 9=7
for var Q8 QB21 Q9 QD1 QB20P1 QB20P2 QB20P6 QB20P4 QB20P3 QB20P5 QC12* QC13* QC14*: recode X 12/13=.

*LR related to vote
*oneway QB21 QB4CB if QB4CB < 8, mea

* LR placement of parties Q2P1-Q2P5: FF, FG, Green, Labour, SF
for var Q2P*: recode X 12 13=.
*sum Q2P*


*BUT LR  self placement NOT clearly content driven on conventional measures
* Q8 Less tax/spend vs more tax/spend
* QD1 Government should MAINTAIN TAXES and SPEND LESS  vs 
*     Government should INCREASE TAXES A LOT and SPEND THE SAME 

* QB20P1 Business and industry should be strictly regulated by the State ///
*  vs  Business and industry should be entirely free from regulation by the State
* QB20P2 Most of business and industry should be owned by the state ///
*	vs	Most of business and industry should be privately owned

* Q3P3 Ordinary working people get their fair share of the nation�s wealth
* Q3P5 There is nothing wrong with some people being a lot richer than others


* reverse to make higher score  on all
* for var  Q3P3 Q3P5 1=7 2=6 3=5 4=4 5=3 6=2 7=1
* for var Q8 QD1: recode X 1=11 2=10 3=9 4=8 5=7 6=6 7=5 8=4 9=3 10=2 11=1


* Add in god and abortion Q for moral dimension

* table QB21, c(mean Q9 mean Q8 mean QD1)
for var Q3P3 Q3P5: recode X 8=.
* table QB21, c(mean Q3P3 mean Q3P5)

* Little connection between these issue/attitude variables and vote
* mlogit QB4CB Q9 Q8 Q3P3 Q3P5 QD1 QB20P1 QB20P2 if QB4CB < 8

* No single scale among these variables 
* apart from correlations between two tax and spend Qs

* reduce model to leave out one of each pair of more correlated items
 
 * Blame: who is to blame?
for var QD3*: recode X 6=.
* table QB4CB, c(mean QD3P1 mean QD3P2 mean QD3P3 mean QD3P4 mean QD3P5)
* mlogit QB4CB QD3* if QB4CB < 8

* Should there have been a bailout?
* svyset [pw=wtc]
recode QD6P1 6=.
* svy: tab QB4CB QD6P1, col

* Economy better or worse, and who could do better?
recode QC4 6=3
recode QC5 3=1.5
recode QC6 3=1.5

* best leader to run country QC14P1, 3,4,5: in touch is QC13, honest is QC12


* party attachment
gen ffid=0
replace ffid=1 if QE2P1==1 | QE2P2==1 | QE2P3==1
gen fgid=0
replace fgid=1 if QE2P1==2 | QE2P2==2 | QE2P3==2
gen lbid=0
replace lbid=1 if QE2P1==3 | QE2P2==3 | QE2P3==3
gen sfid=0
replace sfid=1 if QE2P1==4 | QE2P2==4 | QE2P3==4
gen otherid=0
replace otherid =1 if QE2P1==5 | QE2P2==5 | QE2P3==5 | QE2P1==6 | QE2P2==6 | QE2P3==6

for var QD3*: recode X 6=.
recode QC4 1=5 2=4 3=3 4=2 5=1

* Various policies and emotions
for var QD2*: recode X 3=.
for var QD6* QC10*: recode X 6=.
for var Q5*: recode X 6=.

* CREATE SMALLER FILE WITH JUST THE JEPOP VARIABLES 
keep QB7A QB4CB QB9 QB21 QB9 Q9 Q8 Q3P3 Q3P5 QD1 QB20P1 QB20P2 QB20P4 QB20P6 QB20P3 QB20P5 ///
QC4 QC5 QC6 QC10* QC12* QC13* QC14* Q2P* *id QD2* QD6* QD3*  Q5* wtc region agea QB22A QB7B QB22B
gen ines=2011
rename wtc WEIGHT
save short2011.dta, replace

use short2011, clear

* Run on 2002, 2007 data
use "INESLong_Beta 2.dta", clear

* rename 2002-07 variables as 2011 variables

gen vMISS=.
rename v0195 QB4CB
rename v0239 QB21 
rename v0244 Q9a
rename v0238 Q8 
rename v0240 Q3P3
rename v0243 Q3P5
rename vMISS QD1	
rename v0272 QB20P1 
rename v0271 QB20P2 
rename v0263 QB20P4 
rename v0266 QB20P6 
rename v0282 QB20P3 
rename v0214 QB20P5
rename v0709 QC6
rename v0700 QC4
rename v0701 QC5
rename v0681 QE2P1
rename v0682 QE2P2
rename v0683 QE2P3
rename v0670 Q2P1
rename v0671 Q2P2
rename v0672 Q2P3
rename v0673 Q2P4
rename v0675 Q2P5
rename v0674 Q2P6

rename v0502 QC14P1
rename v0503 QC14P3
rename v0504 QC14P4
replace QC14P3=v0505 if ines==2007

rename v0155 QB7A
rename v0174 QB7B

* Construct new variable for 2002
gen FGLabbetter=0
for var v0703-v0706: replace FGLab=1 if X==2 | X==3
replace FGL=. if v0703==.
recode FGL 0=-1 if v0703==4 | v0703==5
replace QC6=FGL if ines==2002
recode QB4CB 12=7

for var Q8 QB21 QD1 QB20P1 QB20P2 QB20P6 QB20P4 QB20P3 QB20P5 QC14*: recode X 11=.
recode QC6 2=1.5 3=2
recode QC4 6=3

for var QE2P*: recode X 3 5 7 8=8
gen ffid=0
replace ffid=1 if QE2P1==1 | QE2P2==1 | QE2P3==1
gen fgid=0
replace fgid=1 if QE2P1==2 | QE2P2==2 | QE2P3==2
gen lbid=0
replace lbid=1 if QE2P1==4 | QE2P2==4 | QE2P3==4
gen sfid=0
replace sfid=1 if QE2P1==6 | QE2P2==6 | QE2P3==6
gen otherid=0
replace otherid=1 if QE2P1==8 | QE2P2==8 | QE2P3==8

* LR placements of parties
for var Q2P*: recode X 11=.

*LR related to vote
* oneway QB21 QB4CB if ines==2002, mea
* oneway QB21 QB4CB if ines==2007, mea





* Add in god and abortion Q for moral dimension
keep if ines==2002 |ines==2007
sort ines
* by ines: table QB21, c(mean Q9 mean Q9a mean Q8 mean QD1)
for var Q3P3 Q3P5: recode X 8=.
* by ines: table QB21, c(mean Q3P3 mean Q3P5)


* CONSTRUCT SMALLER LONG FILE WITH JEPOP VARIABLES AND ADD 2011 TO IT
keep ines QB7A QB7B QB4CB QB21 Q9* Q8 Q3P3 Q3P5 QD1 QB20P1 QB20P2 QB20P4 QB20P6 QB20P3 QB20P5 ///
  QC* Q2P* v1170 v1181 *id 

gen WEIGHT=v1170
* use cross section weight for 2007
replace WEIGHT=v1181 if ines==2007
append using short2011.dta 
recode QB4CB 3=4 4=6 5=3 6=9 8=7 if ines==2011
for var Q2P*: replace X=X-1 if ines==2011
for var Q8 QB21 QD1 QB20P1 QB20P2 QB20P6 QB20P4 QB20P3 QB20P5 QC12* QC13* QC14*: replace X=X-1 if ines==2011
svyset [pw=WEIGHT]
* for var Q8 QB21 QD1 QB20P1 QB20P2 QB20P6 QB20P4 QB20P3 QB20P5: svy:tab X ines, col

* Proximities
gen proxFF=Q2P1-QB21
gen proxFG=Q2P2-QB21
gen proxLB=Q2P4-QB21
gen proxGr=Q2P3-QB21
gen proxSF=Q2P5-QB21
for var prox*: replace X=abs(X)
egen closest=rmin(prox*)

gen party=.

save short02_11.dta, replace


* data for Figures with voter data (T2) 
svy: tab QC4 ines, col perc format(%3.0f) nomarg
svy: tab QC5 ines, col perc format(%3.0f) nomarg
svy: tab QC6 ines, col perc format(%3.0f) nomarg
svy: tab Q3P3 ines, col perc format(%3.0f) nomarg
svy: tab Q3P5 ines, col perc format(%3.0f) nomarg


* Need to run party id model first

mlogit QB4CB  ffid-otherid if ines==2002 & QB4CB < 8, b(2)
mlogit QB4CB  ffid-otherid if ines==2007 & QB4CB < 8, b(2)
mlogit QB4CB  ffid-otherid if ines==2011 & QB4CB < 8, b(2)



use short02_11, clear

*gen QC4QC5=QC4*QC5

*Recoding QC5 as binary
recode QC5 (1=1) (nonmissing=0)
label define QC5new 1 "Mainly due to policies of that govt" 0 "Not mainly due to policies of that govt" 
label values QC5 QC5new


*Recoding QC6 as binary, lines up 2002 with the rest
recode QC6 (1=1) (nonmissing=0)
label define QC6new 1 "Better" 0 "Not better" 
label values QC6 QC6new

/*Recoding QC4 as three levels due to sparse cells in 2011*/
recode QC4 (1 2 = 1) (3=2) (4 5 = 3) 
label define QC4new 1 "Better" 2 "Same" 3 "Worse"
label values QC4 QC4new

/*Recoding minor parties as Other*/
gen QB4CBnew=QB4CB
recode QB4CBnew (3 = 9) (5=9) (7 = 9) 
label define QB4CBnew 1 "Fianna Fail" 2 "Fine Gael" 4 "Labour" 6 "Sinn Fein" 9 "Other"
label values QB4CBnew QB4CBnew



/*****  TABLE 2 (3 in Text)   *****/


/*2002*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(1)) post
outreg2 using Table2, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(2)) post
outreg2 using Table2, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(4)) post
outreg2 using Table2, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(6)) post
outreg2 using Table2, dec(3) ctitle(Sinn Fein)


/*Other*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(9))




/*2007*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2007, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(1)) post
outreg2 using Table2, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2007, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(2)) post
outreg2 using Table2, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2007, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(4)) post
outreg2 using Table2, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2007, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(6)) post
outreg2 using Table2, dec(3) ctitle(Sinn Fein)

/*Other*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2007, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(9))


/*2011*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(1)) post
outreg2 using Table2, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(2)) post
outreg2 using Table2, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(4)) post
outreg2 using Table2, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(6)) post
outreg2 using Table2, dec(3) ctitle(Sinn Fein)

/*Other*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(9))



/************   TABLE 2A ***************/
* choice as between FF and FG only



/*2002*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2002 & QB4CBnew < 3, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(1)) post
outreg2 using Table2a, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2002 & QB4CBnew < 3, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(2)) post
outreg2 using Table2a, dec(3) ctitle(Fine Gael)




/*2007*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2007 & QB4CBnew < 3, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(1)) post
outreg2 using Table2a, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2007 & QB4CBnew < 3, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(2)) post
outreg2 using Table2a, dec(3) ctitle(Fine Gael)



/*2011*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2011 & QB4CBnew < 3, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(1)) post
outreg2 using Table2a, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6  ffid-otherid if ines==2011 & QB4CBnew < 3, b(2)

margins, dydx(QC4 QC5 QC6) predict(outcome(2)) post
outreg2 using Table2a, dec(3) ctitle(Fine Gael)




/************   TABLE 2B ***************/
* choice as FF + allies vs rest

gen FFa=QB4CB
recode FFa (1 5=1) (nonmissing=0)
label define FFa 1 "Fianna Fail allies" 0 "Not"
label values FFa FFa


logit FFa QC4 i.QC5 i.QC6  ffid-otherid if ines==2002
margins, dydx(QC4 QC5 QC6) post
outreg2 using Table2b, dec(3) ctitle(2002) 

logit FFa QC4 i.QC5 i.QC6  ffid-otherid if ines==2007
margins, dydx(QC4 QC5 QC6) post
outreg2 using Table2b, dec(3) ctitle(2007) 

* for 2011 put greens in with FFa
replace FFa=1 if QB4CB ==3

logit FFa QC4 i.QC5 i.QC6  ffid-otherid if ines==2011
margins, dydx(QC4 QC5 QC6) post
outreg2 using Table2b, dec(3) ctitle(2011) 




* add ANGER to model run for table 2
*  ANGER is QC10P1

mlogit QB4CBnew QC4 i.QC5 i.QC6 QC10P1 ffid-otherid if ines==2011, b(2)



* LEADER COMPETENCES FOR TABLE 3
table ines [pw=WEIGHT], c ( mean QC14P1 mean QC14P3 mean QC14P4 mean QC14P5) format(%3.1f)



/*****    TABLE 3A (4 in text)   *****/
* NOW ADD LEADERS TO TABLE 2 MODEL

/*2002-1*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(1)) post
outreg2 using Table3a, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(2)) post
outreg2 using Table3a, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(4)) post
outreg2 using Table3a, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(6)) post
outreg2 using Table3a, dec(3) ctitle(Sinn Fein)


/*2002-2*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4  ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4) predict(outcome(1)) post
outreg2 using Table3a, dec(3) ctitle(Fianna Fail 2) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4  ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4) predict(outcome(2)) post
outreg2 using Table3a, dec(3) ctitle(Fine Gael 2)

/*Labour*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4 ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4) predict(outcome(4)) post
outreg2 using Table3a, dec(3) ctitle(Labour 2) 

/*SF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4 ffid-otherid if ines==2002, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4) predict(outcome(6)) post
outreg2 using Table3a, dec(3) ctitle(Sinn Fein 2)



/*2007*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2007, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(1)) post
outreg2 using Table3a, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2007, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(2)) post
outreg2 using Table3a, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2007, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(4)) post
outreg2 using Table3a, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2007, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(6)) post
outreg2 using Table3a, dec(3) ctitle(Sinn Fein)




/*2011-1*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(1)) post
outreg2 using Table3a, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(2)) post
outreg2 using Table3a, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(4)) post
outreg2 using Table3a, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3) predict(outcome(6)) post
outreg2 using Table3a, dec(3) ctitle(Sinn Fein)


/*2011-2*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4  ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4) predict(outcome(1)) post
outreg2 using Table3a, dec(3) ctitle(Fianna Fail 2) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4  ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4) predict(outcome(2)) post
outreg2 using Table3a, dec(3) ctitle(Fine Gael 2)

/*Labour*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4 ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4) predict(outcome(4)) post
outreg2 using Table3a, dec(3) ctitle(Labour 2) 

/*SF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4 ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4) predict(outcome(6)) post
outreg2 using Table3a, dec(3) ctitle(Sinn Fein 2)

/*2011-3*/
/*FF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4 QC14P5 ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4 QC14P5) predict(outcome(1)) post
outreg2 using Table3a, dec(3) ctitle(Fianna Fail 3) 

/*FG*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4 QC14P5 ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4 QC14P5) predict(outcome(2)) post
outreg2 using Table3a, dec(3) ctitle(Fine Gael 3)

/*Labour*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4 QC14P5 ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4 QC14P5) predict(outcome(4)) post
outreg2 using Table3a, dec(3) ctitle(Labour 3) 

/*SF*/
mlogit QB4CBnew QC4 i.QC5 i.QC6 QC14P1 QC14P3 QC14P4 QC14P5 ffid-otherid if ines==2011, b(2)

margins, dydx(QC4 QC5 QC6 QC14P1 QC14P3 QC14P4 QC14P5) predict(outcome(6)) post
outreg2 using Table3a, dec(3) ctitle(Sinn Fein 3)



/*****    TABLE 4   *****/
* Issues in 2011
* Construct multiple respose isues variable
for new issue1-issue26: gen X=0
for var issue1-issue26 \ num 1/26: replace X=1 if QB22A==Y | QB22B==Y
for new crisis econ pol: gen X=0
replace pol=1 if issue1==1 | issue2==1
replace crisis=1 if issue5==1| issue6==1|issue8==1|issue14==1
replace econ=1 if issue7==1|issue9==1|issue10==1|issue13==1|issue16==1|issue18==1 
gen other=0
replace other =1 if issue24==1 | issue3==1 | issue4==1

* Do issues matter? redo with just top 10 or so
* mlogit QB4CB ffid-sfid issue* if ines==2011 & QB4CB < 8, b(2)


/*****    TABLE PROX (5 in text)  *****/

* predicting vote by left/right attitudes and policy preferences


/*2002*/
/*FF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 ffid-otherid if ines==2002, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(1)) post
outreg2 using TableProx, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5  ffid-otherid if ines==2002, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(2)) post
outreg2 using TableProx, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 ffid-otherid if ines==2002, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(4)) post
outreg2 using TableProx, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 ffid-otherid if ines==2002, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(6)) post
outreg2 using TableProx, dec(3) ctitle(Sinn Fein)



/*2007*/
/*FF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 ffid-otherid if ines==2007, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(1)) post
outreg2 using TableProx, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5  ffid-otherid if ines==2007, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(2)) post
outreg2 using TableProx, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 ffid-otherid if ines==2007, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(4)) post
outreg2 using TableProx, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 ffid-otherid if ines==2007, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(6)) post
outreg2 using TableProx, dec(3) ctitle(Sinn Fein)



/*2011-1*/
/*FF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(1)) post
outreg2 using TableProx, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5  ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(2)) post
outreg2 using TableProx, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(4)) post
outreg2 using TableProx, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(6)) post
outreg2 using TableProx, dec(3) ctitle(Sinn Fein)


* add extra variables for 2011

/*2011-2*/
/*FF*/
mlogit QB4CBnew Q3P3 Q3P5 QB20P2 QD1 ffid-otherid if ines==2011, b(2)

margins, dydx(Q3P3 Q3P5 QB20P2 QD1) predict(outcome(1)) post
outreg2 using TableProx, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew QB20P1 Q3P3 Q3P5 QB20P2 QD1  ffid-otherid if ines==2011, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1 ) predict(outcome(2)) post
outreg2 using TableProx, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew QB20P1 Q3P3 Q3P5 QB20P2 QD1 ffid-otherid if ines==2011, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1) predict(outcome(4)) post
outreg2 using TableProx, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew QB20P1 Q3P3 Q3P5 QB20P2 QD1 ffid-otherid if ines==2011, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1) predict(outcome(6)) post
outreg2 using TableProx, dec(3) ctitle(Sinn Fein)





/*****    TABLE PROX2   *****/
* predicting vote by left/right attitudes and policy preferences AND LR self placement



/*2002*/
/*FF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2002, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(1)) post
outreg2 using TableProx2, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2002, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(2)) post
outreg2 using TableProx2, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2002, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(4)) post
outreg2 using TableProx2, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2002, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(6)) post
outreg2 using TableProx2, dec(3) ctitle(Sinn Fein)

/*2007*/
/*FF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2007, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(1)) post
outreg2 using TableProx2, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2007, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(2)) post
outreg2 using TableProx2, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2007, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(4)) post
outreg2 using TableProx2, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2007, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(6)) post
outreg2 using TableProx2, dec(3) ctitle(Sinn Fein)


/*2011-1*/
/*FF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(1)) post
outreg2 using TableProx2, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(2)) post
outreg2 using TableProx2, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(4)) post
outreg2 using TableProx2, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21) predict(outcome(6)) post
outreg2 using TableProx2, dec(3) ctitle(Sinn Fein)


/*2011-2*/
/*FF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 QB20P2 QD1 ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21 QB20P2 QD1) predict(outcome(1)) post
outreg2 using TableProx2, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 QB20P2 QD1 ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21 QB20P2 QD1) predict(outcome(2)) post
outreg2 using TableProx2, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 QB20P2 QD1  ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21 QB20P2 QD1) predict(outcome(4)) post
outreg2 using TableProx2, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBnew Q8 QB20P1 Q3P3 Q3P5 QB21 QB20P2 QD1 ffid-otherid if ines==2011, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5 QB21 QB20P2 QD1) predict(outcome(6)) post
outreg2 using TableProx2, dec(3) ctitle(Sinn Fein)


/*****    TABLE 6   *****/
* predicting left right
* be nice to have the same number of cases in both 2011 models

regress QB21 Q8 QB20P1 Q3P3 Q3P5 if ines==2002, vce(robust) 
est store e2002

regress QB21 Q8 QB20P1 Q3P3 Q3P5 if ines==2007, vce(robust) 
est store e2007

regress QB21 Q8 QB20P1 Q3P3 Q3P5 if ines==2011, vce(robust) 
est store e2011a

regress QB21 QB20P1 Q3P3 Q3P5 QB20P2 QD1 if ines==2011, vce(robust) 
est store e2011b

outreg2 [e2002 e2007 e2011a e2011b] using Table6, dec(3)



/*****    TABLE 7   *****/
* party or candidate?
svy: tab QB7A ines if QB4CB < 7 & QB7A < 3, col perc format(%3.0f) nomarg
svy: tab QB7B ines if QB4CB < 7 & QB7A < 3, col perc format(%3.0f) nomarg

gen COP=1
replace COP=2 if QB7A==1 & QB7B==2
replace COP=0 if QB7A==2 & QB7B==1


/*****    TABLE 8a   *****/
* Does left right work better for party voters

/*Recoding for party vote*/
gen QB4CBalt=QB4CB
recode QB4CBalt (3 = 8) (5=8) (7 = 9) 
label define QB4CBalt 1 "Fianna Fail" 2 "Fine Gael" 4 "Labour" 6 "Sinn Fein" 8 "Other parties" 9 "Independent"
label values QB4CBalt QB4CBalt


* predicting vote for party centred voters by left/right attitudes and policy preferences, leaving OUT party ID

/*2002*/
*Party

/*FF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2002 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(1)) post
outreg2 using Table8a, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2002 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(2)) post
outreg2 using Table8a, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2002 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(4)) post
outreg2 using Table8a, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2002 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(6)) post
outreg2 using Table8a, dec(3) ctitle(Sinn Fein)


/*2007*/
/*FF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2007 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(1)) post
outreg2 using Table8a, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2007 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(2)) post
outreg2 using Table8a, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2007 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(4)) post
outreg2 using Table8a, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2007 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(6)) post
outreg2 using Table8a, dec(3) ctitle(Sinn Fein)


/*2011-1*/
/*FF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2011 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(1)) post
outreg2 using Table8a, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2011 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(2)) post
outreg2 using Table8a, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2011 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(4)) post
outreg2 using Table8a, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2011 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(6)) post
outreg2 using Table8a, dec(3) ctitle(Sinn Fein)


/*2011-2*/
* add extra variables for 2011

/*FF*/
mlogit QB4CBalt QB20P1 Q3P3 Q3P5 QB20P2 QD1 if ines==2011 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1) predict(outcome(1)) post
outreg2 using Table8a, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBalt QB20P1 Q3P3 Q3P5 QB20P2 QD1 if ines==2011 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1) predict(outcome(2)) post
outreg2 using Table8a, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBalt QB20P1 Q3P3 Q3P5 QB20P2 QD1 if ines==2011 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1) predict(outcome(4)) post
outreg2 using Table8a, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBalt QB20P1 Q3P3 Q3P5 QB20P2 QD1 if ines==2011 & QB4CBalt < 9 & COP==2, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1) predict(outcome(6)) post
outreg2 using Table8a, dec(3) ctitle(Sinn Fein)







/*****    TABLE 8b   *****/
*Candidate

/*2002*/
/*FF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2002 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(1)) post
outreg2 using Table8b, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2002 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(2)) post
outreg2 using Table8b, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2002 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(4)) post
outreg2 using Table8b, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2002 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(6)) post
outreg2 using Table8b, dec(3) ctitle(Sinn Fein)


/*2007*/
/*FF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2007 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(1)) post
outreg2 using Table8b, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2007 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(2)) post
outreg2 using Table8b, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2007 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(4)) post
outreg2 using Table8b, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2007 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(6)) post
outreg2 using Table8b, dec(3) ctitle(Sinn Fein)


/*2011-1*/
/*FF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2011 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(1)) post
outreg2 using Table8b, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2011 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(2)) post
outreg2 using Table8b, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2011 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(4)) post
outreg2 using Table8b, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBalt Q8 QB20P1 Q3P3 Q3P5 if ines==2011 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(Q8 QB20P1 Q3P3 Q3P5) predict(outcome(6)) post
outreg2 using Table8b, dec(3) ctitle(Sinn Fein)


/*2011-2*/
* add extra variables for 2011

/*FF*/
mlogit QB4CBalt QB20P1 Q3P3 Q3P5 QB20P2 QD1 if ines==2011 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1) predict(outcome(1)) post
outreg2 using Table8b, dec(3) ctitle(Fianna Fail) 

/*FG*/
mlogit QB4CBalt QB20P1 Q3P3 Q3P5 QB20P2 QD1 if ines==2011 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1) predict(outcome(2)) post
outreg2 using Table8b, dec(3) ctitle(Fine Gael)

/*Labour*/
mlogit QB4CBalt QB20P1 Q3P3 Q3P5 QB20P2 QD1 if ines==2011 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1) predict(outcome(4)) post
outreg2 using Table8b, dec(3) ctitle(Labour) 

/*SF*/
mlogit QB4CBalt QB20P1 Q3P3 Q3P5 QB20P2 QD1 if ines==2011 & QB4CBalt < 9 & COP==0, b(2)

margins, dydx(QB20P1 Q3P3 Q3P5 QB20P2 QD1) predict(outcome(6)) post
outreg2 using Table8b, dec(3) ctitle(Sinn Fein)




log close



















































/***** NOT USED BELOW *****/



/***  MARGINS PLOTS  ***/

/*2002*/
mlogit QB4CB i.QC4##i.QC5 i.QC6  ffid-pdid if ines==2002 & QB4CB < 8, b(2)
est store e2002tab2

/*margins for FF*/
*average marginal effect of covariates for voting FF

margins, dydx(QC4 QC5 QC6) predict(outcome(1))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Fianna Fail) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) xscale(range(1.5 9.5)) scheme(s1mono) subtitle(2002) saving(FFme2002, replace)


*average prediction of the interaction term

margins QC4#QC5, predict(outcome(1))

marginsplot, noci ytitle(Probability of voting Fianna Fail) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) subtitle(2002) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2002) plotregion(margin(large))  saving(FFinteraction2002, replace)





/*margins for FG*/
*average marginal effect of covariates for voting FG
margins, dydx(QC4 QC5 QC6) predict(outcome(2))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Fine Gael) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) xscale(range(1.5 9.5)) scheme(s1mono) subtitle(2002) saving(FGme2002, replace)



*average prediction of the interaction term
margins QC4#QC5, predict(outcome(2))

marginsplot, noci ytitle(Probability of voting Fine Gael) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2002) plotregion(margin(large)) saving(FGinteraction2002, replace)


/*margins for LAB*/
*average marginal effect of covariates for voting LAB

*margins, dydx(QC4 QC5 QC6) predict(outcome(4))

*None of QC4 levels are significant but they screw up the graph with CIs, so QC4 is omitted here.
margins, dydx(QC5 QC6) predict(outcome(4))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Labour) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium)) xscale(range(-3 4.5)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2002) saving(LABme2002, replace)

*average prediction of the interaction term
margins QC4#QC5, predict(outcome(4))

marginsplot, noci ytitle(Probability of voting Labour) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2002) plotregion(margin(large)) saving(LABinteraction2002, replace)


/*margins for SF*/
*average marginal effect of covariates for voting SF

margins, dydx(QC4 QC5 QC6) predict(outcome(6))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Sinn Fein) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium)) xscale(range(1.5 9.5)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) graphregion(margin(large)) scheme(s1mono) subtitle(2002) saving(SFme2002, replace)

*average prediction of the interaction term
margins QC4#QC5, predict(outcome(6))

marginsplot, noci ytitle(Probability of voting Sinn Fein) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2002) plotregion(margin(large)) saving(SFinteraction2002, replace)




/*2007*/
mlogit QB4CB i.QC4##i.QC5 i.QC6 ffid-pdid if ines==2007 & QB4CB < 8, b(2)

est store e2007tab2


/*margins for FF*/
*average marginal effect of covariates for voting FF

margins, dydx(QC4 QC5 QC6) predict(outcome(1))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Fianna Fail) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) xscale(range(1.5 9.5)) scheme(s1mono) subtitle(2007) saving(FFme2007, replace)

*average prediction of the interaction term
margins QC4#QC5, predict(outcome(1))

marginsplot, noci ytitle(Probability of voting Fianna Fail) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2007) plotregion(margin(large)) saving(FFinteraction2007, replace)


/*margins for FG*/
*average marginal effect of covariates for voting FG

margins, dydx(QC4 QC5 QC6) predict(outcome(2))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Fine Gael) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) xscale(range(1.5 9.5)) scheme(s1mono) subtitle(2007) saving(FGme2007, replace)

*average prediction of the interaction term
margins QC4#QC5, predict(outcome(2))

marginsplot, noci ytitle(Probability of voting Fine Gael) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2007) plotregion(margin(large)) saving(FGinteraction2007, replace)


/*margins for LAB*/
*average marginal effect of covariates for voting LAB

margins, dydx(QC4 QC5 QC6) predict(outcome(4))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Labour) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium))  title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) xscale(range(1.5 9.5)) scheme(s1mono) subtitle(2007) saving(LABme2007, replace)

*average prediction of the interaction term
margins QC4#QC5, predict(outcome(4))

marginsplot, noci ytitle(Probability of voting Labour) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2007) plotregion(margin(large)) saving(LABinteraction2007, replace)


/*margins for SF*/
*average marginal effect of covariates for voting SF

margins, dydx(QC4 QC5 QC6) predict(outcome(6))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Sinn Fein) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium)) xscale(range(1.5 9.5)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) graphregion(margin(large)) scheme(s1mono) subtitle(2007) saving(SFme2007, replace)

*average prediction of the interaction term
margins QC4#QC5, predict(outcome(6))

marginsplot, noci ytitle(Probability of voting Sinn Fein) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2007) plotregion(margin(large)) saving(SFinteraction2007, replace)



/*2011*/

mlogit QB4CBnew i.QC4 i.QC5 i.QC6  ffid-otherid if ines==2011, b(2)


mlogit QB4CB i.QC4##i.QC5 i.QC6 ffid-sfid if ines==2011 & QB4CB < 8, b(2)

est store e2011tab2



/*margins for FF*/
*average marginal effect of covariates for voting FF

margins, dydx(QC5 QC6) predict(outcome(1))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Fianna Fail) xtitle(Effects with respect to) xtitle(, margin(medium)) xscale(range(-3 4.5)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2011) saving(FFme2011, replace)


*average prediction of the interaction term
margins QC4#QC5, predict(outcome(1))

marginsplot, noci ytitle(Probability of voting Fianna Fail) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2011) plotregion(margin(large)) saving(FFinteraction2011, replace)


/*margins for FG*/
*average marginal effect of covariates for voting FG

margins, dydx(QC5 QC6) predict(outcome(2))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Fine Gael) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium)) xscale(range(-3 4.5)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2011) saving(FGme2011, replace)


*average prediction of the interaction term
margins QC4#QC5, predict(outcome(2))

marginsplot, noci ytitle(Probability of voting Fine Gael) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2011) plotregion(margin(large)) saving(FGinteraction2011, replace)


/*margins for LAB*/
*average marginal effect of covariates for voting LAB

margins, dydx(QC5 QC6) predict(outcome(4))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Labour) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium)) xscale(range(-3 4.5)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2011) saving(LABme2011, replace)


*average prediction of the interaction term
margins QC4#QC5, predict(outcome(4))

marginsplot, noci ytitle(Probability of voting Labour) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2011) plotregion(margin(large)) saving(LABinteraction2011, replace)


/*margins for SF*/
*average marginal effect of covariates for voting SF

margins, dydx(QC5 QC6) predict(outcome(6))

marginsplot, recast(scatter) ytitle(Effects on probability of voting Sinn Fein) yline(0, lwidth(vthin) lcolor(red)) xtitle(Effects with respect to) xtitle(, margin(medium)) xscale(range(-3 4.5)) title(Average Marginal Effects with 95% CIs, justification(right)) legend(cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2011) saving(SFme2011, replace)

*average prediction of the interaction term
margins QC4#QC5, predict(outcome(6))

marginsplot, noci ytitle(Probability of voting Sinn Fein) xtitle(Economy in Ireland over last 5 years has ...) xtitle(, margin(medium)) xlabel(, labsize(vsmall)) title(Adjusted predictions of the interaction term) legend(order(2 "Government fault" 1 "Not government fault") cols(1) region(lcolor(none))) scheme(s1mono) subtitle(2011) plotregion(margin(large)) saving(SFinteraction2011, replace)


graph combine FFme2002.gph FFinteraction2002.gph FFme2007.gph FFinteraction2007.gph FFme2011.gph FFinteraction2011.gph, title(Fianna Fail) cols(2) ysize(8) saving(tab2-FF, replace) scheme(s1mono) iscale(.45)

graph export tab2-FF.pdf, replace


graph combine FGme2002.gph FGinteraction2002.gph FGme2007.gph FGinteraction2007.gph FGme2011.gph FGinteraction2011.gph, title(Fine Gael) cols(2) ysize(8) saving(tab2-FG, replace) scheme(s1mono) iscale(.45)

graph export tab2-FG.pdf, replace


graph combine LABme2002.gph LABinteraction2002.gph LABme2007.gph LABinteraction2007.gph LABme2011.gph LABinteraction2011.gph, title(Labour) cols(2) ysize(8) saving(tab2-LAB, replace) scheme(s1mono) iscale(.45)

graph export tab2-LAB.pdf, replace

graph combine SFme2002.gph SFinteraction2002.gph SFme2007.gph SFinteraction2007.gph SFme2011.gph SFinteraction2011.gph, title(Sinn Fein) cols(2) ysize(8) saving(tab2-SF, replace) scheme(s1mono) iscale(.45)

graph export tab2-SF.pdf, replace




outreg2 [e2002tab2 e2007tab2 e2011tab2] using Table2, stats(coef se) see onecol replace drop(ffid fgid lbid sfid) 





 
